package com.xtm.exercise.base.A08map.map03;

import org.junit.Test;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class ConCurrentHashMapDemo {

    @Test
    public void test01(){
        ConcurrentHashMap<String, String> cmap = new ConcurrentHashMap<>();
        cmap.put("陈赫","陈赫1");
        cmap.put("王一博","王一博2");
        cmap.put("鹿晗","鹿晗3");
        cmap.put("邓超","邓超4");

        String Lh = cmap.get("鹿晗");
        System.out.println(Lh);

        Set<Map.Entry<String,String>> entrySet = cmap.entrySet();
        for (Map.Entry<String,String> entry:entrySet) {
            System.out.println(entry.getKey() + " - " + entry.getValue());
        }

    }
}
